﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace odinshrine
{
    struct ElemSpe
    {
        public Elements Elts;
        public Vector2 Pos;
    }
    class Structure
    {
        public Elements[] Elts = new Elements[200];
        public  ElemSpe beg, end;
        public int counter = 0;

        public Structure()
        {

        }

        public Structure(Structure stru)
        {
            this.Elts = stru.Elts;
            this.beg = stru.beg;
            this.end = stru.end;
            this.counter = stru.counter;
        }

        public void Add(Elements Elt, Vector2 pos, Elements[,] tab)
        {
            if (Elt.type == Elts_T.Plateform)
            {
                if (counter == 0)
                {
   //                 Elt.sprte_e.ChangeAnime("Left", true);
       //             tab[(int)pos.X / 34, (int)pos.Y / 34].sprte_e.ChangeAnime("Left", true);
                    beg.Elts = Elt;

                    beg.Pos = pos;

                }
                else
                {
                    if (counter > 1)
                    {
   //                     Elts[counter - 1].sprte_e.ChangeAnime("Mid", true);
  //                      tab[(int)pos.X / 34,(int) pos.Y / 34].sprte_e.ChangeAnime("Mid", true);
                    }
                }
                Elts[counter] = Elt;
                end.Elts = Elt;
                end.Pos = pos;
      //          Elts[counter].sprte_e.ChangeAnime("Right", true);
  //          tab[(int)pos.X / 34,(int) pos.Y / 34].sprte_e.ChangeAnime("Right", true);
                counter++;
            }
            else
            {
                Elts[counter] = Elt;
                beg.Elts = Elt;
                beg.Pos = pos;
                counter++;
            }
        }

        public void Remove()
        {
            if (counter >= 1)
                counter--;
            else
                throw (new Exception() );
        }

        public void Reset()
        {
            counter = 0;
        }
    }
}
